#APP_KEY = '4029247573' # app key
#APP_SECRET = 'fc0a6dc9b30355512f1cc70088f8b71b' # app secret
APP_KEY = '3369673566' # app key
APP_SECRET = 'fc32020142353e0137875ad009fac4a4' # app secret
CALLBACK_URL = 'http://58.196.13.55/weibo' # callback url

ACCESS_KEY_LIST = [ 'oauth_token', \
                    'oauth_token_secret',\
                    'oauth_verifier',\
                    'user_id']

token_file = "token.1"
def save_access_token(access_token):
    f1=open(token_file, "w")
    for t in ACCESS_KEY_LIST:
        f1.writelines(str(getattr(access_token, t)) + '\n')
    f1.close()

def read_access_token():
    f1=open(token_file, "r")
    i = 0
    access_token = dict()
    for line in open(token_file, "r"):
        access_token[ACCESS_KEY_LIST[i]] = \
            line=='None' and None or line[0:len(line)-1]
        i = i + 1
    f1.close();
    return dict(**access_token)

